//
// Created by 17775 on 2024/9/19.
//

#ifndef RAYCI_LIVEMODE_CROSSSECTION_OPTIONS_H
#define RAYCI_LIVEMODE_CROSSSECTION_OPTIONS_H

#include <QDockWidget>
#include <QButtonGroup>


QT_BEGIN_NAMESPACE
namespace Ui { class LiveMode_CrossSection_Options; }
QT_END_NAMESPACE

enum class Coordinate {
    X_Cross,
    Y_Cross,
    Radial,
    Arbitrary,
    Circular
};

enum class Coordinate_Unit{
    px,
    um,
    mm,
    cm,
    in,
    m
};

enum class MethodType {
    None = 0,
    Sinc2 = 1,
    Gauss = 2,
    SuperGauss = 3,
    Sech2 = 4,
    Lorentz = 5
};

class LiveMode_CrossSection_Options : public QDockWidget {
Q_OBJECT

signals:
    void showAbscissa(bool show);
    void showOrdinate(bool show);
    void setYPositionMethod(int index);
    void setFitMethod(MethodType type);
    void setTargetActivate(bool bActivate);
    void setLimitEnable(bool bEnable);

public:
    explicit LiveMode_CrossSection_Options(QWidget *parent = nullptr);

    ~LiveMode_CrossSection_Options() override;
    void setXCrossSectionPos(double pos);
    void initSetting();
    double getStdCsX01();
    double getStdCsY01();
    double getStdCsX02();
    double getStdCsY02();

    double x_pos_px = 0;

    void setCoordinate(Coordinate type);
    void changeCoordinateUnit(const QString& unit);
    void updateFitMethod();
    void updateAspectContent(Coordinate type);

private:
    Ui::LiveMode_CrossSection_Options *ui;
    QButtonGroup *fitMethodButtonGroup = nullptr;
};


#endif //RAYCI_LIVEMODE_CROSSSECTION_OPTIONS_H
